package com.netty.timeold;

import com.sevenchildren.framework.enums.SuperStrEnum;
import com.sevenchildren.framework.util.EnumUtils;

public enum ReqTypeEnum implements SuperStrEnum {

	PING("ping", "心跳");

	/**
	 * @param code
	 * @param description
	 */
	private ReqTypeEnum(String code, String description) {
		this.code = code;
		this.description = description;
		EnumUtils.put(this.getClass().getName() + code, this);
	}

	/**
	 * <pre>
	 * 一个便利的方法，方便使用者通过code获得枚举对象，
	 * 对于非法状态，以个人处理&lt;/b&gt;
	 * </pre>
	 * 
	 * @param code
	 * @return
	 */
	public static ReqTypeEnum codeOf(String code) {
		Object obj = EnumUtils.get(ReqTypeEnum.class.getName() + code);
		if (null != obj) {
			return (ReqTypeEnum) obj;
		}
		return null;
	}

	/** 编码 */
	private String code;

	/** 描述的KEY */
	private String description;

	@Override
	public String getCode() {
		return code;
	}

	@Override
	public void setCode(String code) {
		this.code = code;
	}

	@Override
	public String getDescription() {
		return description;
	}

	@Override
	public void setDescription(String description) {
		this.description = description;
	}

}
